﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using log4net;
using TFXK.BLL;
using TFXK.Common;
using log4net;
using TFXK.Model;
using System.Data;
public partial class About : System.Web.UI.Page
{
    private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
    private static readonly NewsBLL bllNews = new NewsBLL();
    private static readonly CategoryBLL bllCategory = new CategoryBLL();

    private static readonly PicturesBLL bllPictures = new PicturesBLL();

    #region 加载
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["CodeNo"] != null)
                {
                    try
                    {
                        string CodeNo = StringUtil.HtmlEncode(Request.QueryString["CodeNo"].ToString());
                        InitData(CodeNo);
                    }
                    catch
                    {
                        InitData("gywm");
                    }
                }
            }
        }
        catch (Exception ex)
        {
            log.Error(ex.Message);
            Response.Redirect("About.aspx.aspx", false);
        }
    }
    #endregion

    #region 绑定
    private void InitData(string code)
    {
        Category model = bllCategory.GetModel(code);
        lblTitle.Text = model.title;
        lblContent.Text = model.description;
        try
        {
            SetImgNav(code);
        }
        catch
        {

        }
    }
    #endregion



    public void SetImgNav(string code)
    {
        if (code.Equals("gywm"))
        {
            imgNav.ImageUrl = "images/gywm.jpg";
        }
        else if (code.Equals("lxwm"))
        {
            imgNav.ImageUrl = "images/lxwm.jpg";
        }
        else if (code.Equals("mzsm"))
        {
            imgNav.ImageUrl = "images/mzsm.jpg";
        }
        else if (code.Equals("lycjwt"))
        {
            imgNav.ImageUrl = "images/cjwt.jpg";
        }
        else if (code.Equals("ggfw"))
        {
            imgNav.ImageUrl = "images/ggfw.jpg";
        }
    }
}
